package org.keyuan.struts1.form.converter;

import org.apache.commons.beanutils.Converter;
import org.keyuan.entity.OrderState;

public class OrderStateConverter implements Converter {

	@SuppressWarnings("unchecked")
	public Object convert(Class clazz, Object value) {
		if (clazz == String.class) {
			return value.toString();
		}
		if (clazz == OrderState.class) {
			try {
				return OrderState.valueOf(value.toString());
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return null;
	}

}
